const { Article } = require('../../model/article')
const sexPage = require('mongoose-sex-page')
module.exports = async(req, res) => {
    req.app.locals.currentLink = 'article';

    let page = req.query.page;
    // let count = await Article.countDocuments();
    // let pagesize = 10;
    // let total = Math.ceil(count / pagesize)
    // let start = (page - 1) * pagesize;
    // const articles = await Article.find().limit(10).skip(start);
    const articles = await sexPage(Article).find().page(page).size(2).display(3).exec();
    res.render('admin/article', {
        articles: articles,

    })
}